123456/H5 2324/arrays.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>Arrays</title>
</head>
<body>
<?php
$getallen = [];
$getallen = array(4,2,7,8,3,9,11,13);
//echo count($getallen);
$hoofdsteden =[];
$hoofdsteden['Suriname'] = 'Paramaribo';
$hoofdsteden['IJsland'] = 'Reykjavik';
$hoofdsteden['België'] = 'Brussel';
$hoofdsteden['Nederland'] = 'Amsterdam';
arsort($hoofdsteden);
foreach($hoofdsteden as $land => $stad){
echo "<div>De hoofdstad van $land is $stad.</div>";
}
for($i=0;$i < count($getallen);$i = $i+1 ){
// echo "<div>$getallen[$i]</div>";
}
foreach($getallen as $etiket => $getal){
// echo "<div>$etiket: $getal</div>";
// echo "<div>$etiket: $getallen[$etiket]</div>";
}
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse